﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FileIo
{
    class Program
    {
        static void Main(string[] args)
        {//读取文件内容
            string path = @"D:\mySolo\test.txt"; 
            StreamReader streamReader = new StreamReader(path);
            while (streamReader.Peek() != -1) {
                string str= streamReader.ReadLine();
                Console.WriteLine(str); 
            } 
            streamReader.Close();
            Console.WriteLine();
            //写入内容
            string path1 = @"D:\mySolo\test1.txt";
            StreamWriter streamWriter = new StreamWriter(path1);
            streamWriter.WriteLine("高  还没富  但  帅"); 
            streamWriter.Flush();
            streamWriter.Close();
            Console.WriteLine("以写入内容");
            Console.WriteLine();
            DriveInfo driveInfo = new DriveInfo("D"); 
            Console.WriteLine("驱动器的名称：" + driveInfo.Name);
            Console.WriteLine("驱动器类型：" + driveInfo.DriveType);
            Console.WriteLine("驱动器的文件格式：" + driveInfo.DriveFormat);
            Console.WriteLine("驱动器中可用空间大小：" + driveInfo.TotalFreeSpace);
            Console.WriteLine("驱动器总大小：" + driveInfo.TotalSize);
        }
    }
    
}
